package classloader;

import demo.TestMain;

import java.util.Objects;

public class MyClassLoaderTest {
    public static void main(String[] args) {
        Class<TestMain> testMainClass = TestMain.class;

        MyClassLoader classLoader = new MyClassLoader("D:\\lagou\\java\\learn_10_jvm\\");
        try {
            Class<?> clazz = classLoader.loadClass("TestMain");
            System.out.println("TestMain字节码是由"+clazz.getClassLoader().getClass().getName()+"加载的..");
            System.out.println(Objects.equals(testMainClass,clazz.getClassLoader().getClass()));
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
